#include <iostream>
#include <chrono>
#include <thread>
#include "ThreadPool.h"

class TaskExampleA: public Task{
public:
    Any run(){
        std::cout<<"Atid:"<<std::this_thread::get_id()<<"begin"<<std::endl;
        std::this_thread::sleep_for(std::chrono::seconds(3));
        std::cout<<"Atid:"<<std::this_thread::get_id()<<"endl"<<std::endl;
        return Any();
    }
};

class TaskExampleB: public Task{
public:
    Any run(){
        std::cout<<"Btid:"<<std::this_thread::get_id()<<"begin"<<std::endl;
        std::this_thread::sleep_for(std::chrono::seconds(2));
        std::cout<<"Btid:"<<std::this_thread::get_id()<<"endl"<<std::endl;
        return Any();
    }
};

int main() {
   ThreadPool pool;
   pool.start(4);
   pool.submitTask(std::make_shared<TaskExampleA>());
   pool.submitTask(std::make_shared<TaskExampleB>());
   std::this_thread::sleep_for(std::chrono::seconds(5));
}
